package com.wteam.dragon;

import com.wteam.dragon.system.util.SpringContextHolder;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @Author 陈晓辉
 * @Date 2020/12/18 10:56
 */
@EnableCaching
@EnableScheduling
@SpringBootApplication
@MapperScan({"com.gitee.sunchenbin.mybatis.actable.dao.*",
             "com.wteam.dragon.system.aop.log.controller.mapper",
             "com.wteam.dragon.system.apps.security.control.mapper",
             "com.wteam.dragon.system.apps.server.mapper",
             "com.wteam.dragon.system.apps.generator.mapper",
             "com.wteam.dragon.model.mapper",
             "com.wteam.dragon.station.mapper"})
@ComponentScan({"com.gitee.sunchenbin.mybatis.actable.manager.*",
                "com.wteam.dragon.*",
                "org.springframework.web.filter.*"})
public class DragonApplication {
    public static void main(String[] args) {
        SpringApplication.run(DragonApplication.class, args);
    }

    @Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }

    @Bean
    public ServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
        fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
        return fa;
    }
}
